#!/usr/bin/env python3
#_*_coding: utf-8 _*_
#@Time   : 17:00
#@Author :zhangyan
#@Software  :PyCharm
import os
import sys
import unittest

import selenium.webdriver


# @Time   : 2019/10/18 16:09
# @Author : zhangyan
class tool:
    @staticmethod
    def openGoogle(url):
        driver = selenium.webdriver.Chrome('D:\chromedriver.exe')
        sys.path.append(os.getcwd())
        driver.maximize_window()
        driver.set_page_load_timeout(30)
        driver.implicitly_wait(30)
        driver.get(url)
        return driver
class MyTestCase(unittest.TestCase):
    #@Time   : 2019/12/5 14:17
    #@Author : zhangyan
    #@Desc   : 登陆测试
    def test_login(self):
        driver = tool.openGoogle('https://cert.ccpbox.com/login.html')
        driver.find_element_by_id('userName').send_keys('sweet')
        driver.find_element_by_id('passWord').send_keys('123456')
        driver.find_element_by_xpath('/html/body/div[1]/div/div[3]').click()
        result =  driver.find_element_by_id('accountName').text
        self.assertEqual(result=='zhangyan',True)
        driver.quit()
if __name__ == '__main__':
    unittest.main()
